#!/bin/sh
##
##  Partysip - The partysip SIP Proxy Server
##  Copyright (c) 2002 WellX Telecom <partysip@wellx.org>
##  Copyright (c) 2002 Aymeric MOIZARD <jack@partysip.org>
##
##  This file is part of partysip, a SIP proxy Server
##  program which can be found at http://www.partysip.org/.
##
##  This program is free software; you can redistribute it and/or
##  modify it under the terms of the GNU Lesser General Public
##  License as published by the Free Software Foundation; either
##  version 2.1 of the License, or (at your option) any later version.
##
##  This program is distributed in the hope that it will be useful,
##  but WITHOUT ANY WARRANTY; without even the implied warranty of
##  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
##  Lesser General Public License for more details.
##
##  You should have received a copy of the GNU Lesser General Public
##  License along with this library; if not, write to the Free Software
##  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
##  USA, or contact Ralf S. Engelschall <rse@engelschall.com>.
##
##  partysip-config.in: partysip plugin build utility
##

DIFS=' 	
'

prefix="@prefix@"
exec_prefix="@exec_prefix@"

partysip_prefix="$prefix"
partysip_exec_prefix="$exec_prefix"
partysip_bindir="@bindir@"
partysip_libdir="@libdir@"
partysip_includedir="@includedir@"
partysip_mandir="@mandir@"
partysip_datadir="@datadir@"
partysip_cflags="@CFLAGS@ @PARTYSIP_FLAGS@ -DPSP_SERVER_PREFIX=\"$partysip_prefix\""
partysip_ldflags="@LDFLAGS@ -O -Wall -export-dynamic"
partysip_libs="@LIBS@ @PARTYSIP_LIB@ -losip2"
partysip_version="@VERSION@"

help=no
version=no

usage="partysip-config"
usage="$usage [--help] [--version]"
usage="$usage [--prefix] [--exec-prefix] [--bindir] [--libdir] [--includedir] [--mandir] [--datadir]"
usage="$usage [--cflags] [--ldflags] [--libs]"
if [ $# -eq 0 ]; then
    echo "partysip-config:Error: Invalid option" 1>&2
    echo "partysip-config:Usage: $usage" 1>&2
    exit 1
fi
output=''
prev=''
OIFS="$IFS" IFS="$DIFS"
for option
do
    if [ ".$prev" != . ]; then
        eval "$prev=\$option"
        prev=''
        continue
    fi
    case "$option" in
        -*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
           *) optarg='' ;;
    esac
    case "$option" in
        --help|-h)
            echo "Usage: $usage"
            echo "Report bugs to partysip@wellx.com"
            exit 0
            ;;
        --version|-v)
            echo "Partysip $partysip_version"
            exit 0
            ;;
        --prefix)
            output="$output $partysip_prefix"
            ;;
        --exec-prefix)
            output="$output $partysip_exec_prefix"
            ;;
        --bindir)
            output="$output $partysip_bindir"
            ;;
        --libdir)
            output="$output $partysip_libdir"
            ;;
        --includedir)
            output="$output $partysip_includedir"
            ;;
        --mandir)
            output="$output $partysip_mandir"
            ;;
        --datadir)
            output="$output $partysip_datadir"
            ;;
        --cflags)
            output="$output -I$partysip_includedir $partysip_cflags"
            ;;
        --ldflags)
            output="$output -L$partysip_libdir $partysip_ldflags"
            ;;
        --libs)
            output="$output $partysip_libs"
            ;;
        * )
            echo "partysip-config:Error: Invalid option" 1>&2
            echo "partysip-config:Usage: $usage" 1>&2
            exit 1;
            ;;
    esac
done
IFS="$OIFS"
if [ ".$prev" != . ]; then
    echo "partysip-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
    exit 1
fi
if [ ".$output" != . ]; then
    echo $output
fi

